package web.Employee;

import com.google.gson.Gson;
import entity.EmployeeBean;
import services.EmployeeService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/GetEmployeeID")
public class GetEmployeeID extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json");
        int employee_id = Integer.parseInt(req.getParameter("employee_id"));
        EmployeeBean employeeBean = new EmployeeService().getEmployeeID(employee_id);
        Gson gson = new Gson();
        String json = gson.toJson(employeeBean);
        resp.getWriter().println(json);
    }
}
